﻿using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.ServiceModel;

namespace Telerik.Sitefinity.Services.Migration
{
	[DataContract]
	public class MigrationItemStatistics
	{
		public MigrationItemStatistics()
		{
			ContentLanguages = new List<string>();
		}

		[DataMember]
		public int RolesCount;

		[DataMember]
		public int UsersCount;

		[DataMember]
		public int GenericContentsCount;

		[DataMember]
		public int NewsCount;

		[DataMember]
		public int BlogsCount;

		[DataMember]
		public int BlogPostsCount;

		[DataMember]
		public int EventsCount;

		[DataMember]
		public int ImageLibrariesCount;

		[DataMember]
		public int DocumentLibrariesCount;

		[DataMember]
		public int VideoLibrariesCount;

		[DataMember]
		public int ListsCount;

		[DataMember]
		public int PollsCount;

		[DataMember]
		public int ForumsCount;

		[DataMember]
		public int ForumPostsCount;

		[DataMember]
		public int MasterPagesCount;

		[DataMember]
		public int ThemesCount;

		[DataMember]
		public int TemplatesCount;

		[DataMember]
		public int PagesCount;

		[DataMember]
		public List<string> ContentLanguages;

		[DataMember]
		public string DefaultLanguage;
	}

	[DataContract]
	public class MigrationItemContentDefinition
	{
		[DataMember]
		public Guid Id;

		[DataMember]
		public String Name;

		[DataMember]
		public string ProviderName;

		[DataMember]
		public string Language;

		[DataMember]
		public int SubItemsCount;
	}

	[DataContract]
	public class MigrationPageContentDefinition
	{
		[DataMember]
		public Guid Id;

		[DataMember]
		public Guid ParentId;

		[DataMember]
		public string ProviderName;
	}

	[DataContract]
	public class MigrationMetaDataDefinition
	{
		[DataMember]
		public string Caption;

		[DataMember]
		public object DefaultValue;

		[DataMember]
		public string Key;

		[DataMember]
		public bool Localizable;

		[DataMember]
		public bool Mandatory;

		[DataMember]
		public bool Searchable;

		[DataMember]
		public bool Sortable;

		[DataMember]
		public string ValueType;

		[DataMember]
		public bool Visible;
	}

	[DataContract]
	public class MigrationProvider
	{
		public MigrationProvider()
		{
			MetaDataDefinitions = new List<MigrationMetaDataDefinition>();
		}

		[DataMember]
		public bool AllowComments;

		[DataMember]
		public bool AllowLocalization;

		[DataMember]
		public bool AllowVersioning;

		[DataMember]
		public bool AllowWorkflow;

		[DataMember]
		public string Application;

		[DataMember]
		public bool CommentsModeration;

		[DataMember]
		public string DefaultMetaField;

		[DataMember]
		public string Name;

		[DataMember]
		public string Type;

		[DataMember]
		public string UrlDateTimeFormat;

		[DataMember]
		public string UrlRewriteFormat;

		[DataMember]
		public string UrlWhiteSpaceChar;

		[DataMember]
		public bool Visible;

		[DataMember]
		public List<MigrationMetaDataDefinition> MetaDataDefinitions;
	}

	[DataContract]
	public class MigrationComment
	{
		[DataMember]
		public string Author;

		[DataMember]
		public string Email;

		[DataMember]
		public Guid Id;

		[DataMember]
		public string IpAddress;

		[DataMember]
		public string Owner;

		[DataMember]
		public string Text;

		[DataMember]
		public bool Visible;

		[DataMember]
		public string WebSite;
	}

	[DataContract(Name = "MigrationGenericContent", Namespace = "Telerik.Migration")]
	public class MigrationGenericContent
	{
		public MigrationGenericContent()
		{
			Comments = new List<MigrationComment>();
			MetaData = new Dictionary<string, object>();
			Tags = new List<string>();
		}

		[DataMember]
		public List<MigrationComment> Comments;

		[DataMember]
		public object Content;

		[DataMember]
		public DateTime DateCreated;

		[DataMember]
		public DateTime DateModified;

		[DataMember]
		public Guid Id;

		[DataMember]
		public string ItemInfo;

		[DataMember]
		public string Language;

		[DataMember]
		public string MimeType;

		[DataMember]
		public string ProviderName;

		[DataMember]
		public string Status;

		[DataMember]
		public string Url;

		[DataMember]
		public Dictionary<string, object> MetaData;

		[DataMember]
		public List<string> Tags;
	}

	[DataContract]
	public class MigrationBlog
	{
		public MigrationBlog()
		{
			Posts = new List<MigrationGenericContent>();
		}

		[DataMember]
		public bool AllowComments;

		[DataMember]
		public string Author;

		[DataMember]
		public string BlogPage;

		[DataMember]
		public bool CommentsModeration;

		[DataMember]
		public DateTime DateCreated;

		[DataMember]
		public string Description;

		[DataMember]
		public Guid Id;

		[DataMember]
		public string Name;

		[DataMember]
		public string Owner;

		[DataMember]
		public string ProviderName;

		[DataMember]
		public string PostPage;

		[DataMember]
		public List<MigrationGenericContent> Posts;
	}

	[DataContract]
	public class MigrationEvent : MigrationGenericContent
	{
		[DataMember]
		public DateTime End;

		[DataMember]
		public string EventTitle;

		[DataMember]
		public string RecurringRule;

		[DataMember]
		public DateTime Start;
	}

	[DataContract]
	public class MigrationLibrary
	{
		public MigrationLibrary()
		{
			Documents = new List<MigrationGenericContent>();
		}

		[DataMember]
		public DateTime DateCreated;

		[DataMember]
		public Guid Id;

		[DataMember]
		public int MaxFiles;

		[DataMember]
		public long MaxFileSize;

		[DataMember]
		public long MaxSize;

		[DataMember]
		public string Name;

		[DataMember]
		public string Owner;

		[DataMember]
		public bool RequireCaching;

		[DataMember]
		public string TypeName;

		[DataMember]
		public List<MigrationGenericContent> Documents;
	}

	[DataContract]
	public class MigrationListItem
	{
		[DataMember]
		public string Content;

		[DataMember]
		public bool HasDynamicLinks;

		[DataMember]
		public string Headline;

		[DataMember]
		public Guid Id;

		[DataMember]
		public int Ordinal;
	}

	[DataContract]
	public class MigrationList
	{
		public MigrationList()
		{
			Items = new List<MigrationListItem>();
		}

		[DataMember]
		public DateTime Created;

		[DataMember]
		public Guid Id;

		[DataMember]
		public string Name;

		[DataMember]
		public string Owner;

		[DataMember]
		public string ProviderName;

		[DataMember]
		public List<MigrationListItem> Items;
	}

	[DataContract]
	public class MigrationPollAnswer
	{
		[DataMember]
		public int ChartColor;

		[DataMember]
		public Guid Id;

		[DataMember]
		public double Percentage;

		[DataMember]
		public int SortOrder;

		[DataMember]
		public string Text;

		[DataMember]
		public int VoteCount;
	}

	[DataContract]
	public class MigrationPollQuestion
	{
		public MigrationPollQuestion()
		{
			Answers = new List<MigrationPollAnswer>();
		}

		[DataMember]
		public Guid Id;

		[DataMember]
		public string Layout;

		[DataMember]
		public int SortOrder;

		[DataMember]
		public string Text;

		[DataMember]
		public List<MigrationPollAnswer> Answers;
	}

	[DataContract]
	public class MigrationPoll
	{
		public MigrationPoll()
		{
			Questions = new List<MigrationPollQuestion>();
		}

		[DataMember]
		public Guid Id;

		[DataMember]
		public string Owner;

		[DataMember]
		public string ProviderName;

		[DataMember]
		public string Title;

		[DataMember]
		public int VoterNumber;

		[DataMember]
		public List<MigrationPollQuestion> Questions;
	}

	[DataContract]
	public class MigrationForumPost
	{
		[DataMember]
		public string AuthorIp;

		[DataMember]
		public string Content;

		[DataMember]
		public DateTime DateCreated;

		[DataMember]
		public Guid Id;

		[DataMember]
		public string Owner;

		[DataMember]
		public Guid ParentId;

		[DataMember]
		public string Status;

		[DataMember]
		public Guid ThreadId;

		[DataMember]
		public string Title;
	}

	[DataContract]
	public class MigrationForum
	{
		public MigrationForum()
		{
			Posts = new List<MigrationForumPost>();
		}

		[DataMember]
		public string CategoryName;

		[DataMember]
		public string CategoryDescription;

		[DataMember]
		public DateTime DateCreated;

		[DataMember]
		public bool DenyAnonymous;

		[DataMember]
		public string Description;

		[DataMember]
		public Guid Id;

		[DataMember]
		public bool ModeratePosts;

		[DataMember]
		public string Name;

		[DataMember]
		public string ProviderName;

		[DataMember]
		public string Status;

		[DataMember]
		public List<MigrationForumPost> Posts;
	}

	[DataContract]
	public class MigrationCssFile
	{
		[DataMember]
		public string FileName;

		[DataMember]
		public string FileContents;
	}

	[DataContract]
	public class MigrationImageFile
	{
		[DataMember]
		public string FileName;

		[DataMember]
		public byte[] ImageData;
	}

	[DataContract]
	public class MigrationTheme
	{
		public MigrationTheme()
		{
			CssFiles = new List<MigrationCssFile>();
			ImageFiles = new List<MigrationImageFile>();
		}

		[DataMember]
		public string ThemeName;

		[DataMember]
		public List<MigrationCssFile> CssFiles;

		[DataMember]
		public List<MigrationImageFile> ImageFiles;
	}

	[DataContract]
	public class MigrationCmsWebControl
	{
		[DataMember]
		public string ContainerId;

		[DataMember]
		public string ControlTypeName;

		[DataMember]
		public Guid Id;

		[DataMember]
		public bool IsAscx;

		[DataMember]
		public string ItemType;

		[DataMember]
		public string Name;

		[DataMember]
		public int Ordinal;

		[DataMember]
		public string TypeName;

		[DataMember]
		public string ErrorMessage;
	}

	[DataContract]
	public class MigrationCmsAscxControl : MigrationCmsWebControl
	{
		[DataMember]
		public string AscxFilePath;

		[DataMember]
		public string AscxFileContent;

		[DataMember]
		public string AscxCodeBehindFileName;

		[DataMember]
		public string AscxFileCondeBehindContent;
	}

	[DataContract]
	public class MigrationCmsGenericContent : MigrationCmsWebControl
	{
		[DataMember]
		public string Content;
	}

	[DataContract]
	public class MigrationCmsImage : MigrationCmsWebControl
	{
		[DataMember]
		public string AlternateText;

		[DataMember]
		public string ImageAlign;

		[DataMember]
		public byte[] ImageData;

		[DataMember]
		public string ImageUrl;
	}

	[DataContract]
	public class MigrationCmsDynamicHyperLink : MigrationCmsWebControl
	{
		[DataMember]
		public string NavigateUrl;

		[DataMember]
		public string Target;

		[DataMember]
		public string Text;
	}

	[DataContract]
	public class MigrationCmsHyperLink : MigrationCmsWebControl
	{
		[DataMember]
		public string NavigateUrl;

		[DataMember]
		public string Target;

		[DataMember]
		public string Text;
	}

	[DataContract]
	public class MigrationCmsListDisplay : MigrationCmsWebControl
	{
		public MigrationCmsListDisplay()
		{
			ListIds = new List<Guid>();
		}

		public List<Guid> ListIds;
	}

	[DataContract]
	public class MigrationCmsSubscriptionForm : MigrationCmsWebControl
	{
	}

	[DataContract]
	public class MigrationCmsSearchBox : MigrationCmsWebControl
	{
	}

	[DataContract]
	public class MigrationCmsDownloadList : MigrationCmsWebControl
	{
	}

	[DataContract]
	public class MigrationCmsImageGallery : MigrationCmsWebControl
	{
	}

	[DataContract]
	public class MigrationCmsContentView : MigrationCmsWebControl
	{

	}

	[DataContract]
	public class MigrationCmsBlogPosts : MigrationCmsContentView
	{
	}

	[DataContract]
	public class MigrationCmsEventsView : MigrationCmsContentView
	{
	}

	[DataContract]
	public class MigrationCmsNewsView : MigrationCmsContentView
	{
	}

	[DataContract]
	public class MigrationPermission
	{
		[DataMember]
		public string RoleName;

		[DataMember]
		public int Grant;

		[DataMember]
		public int Deny;
	}

	[DataContract]
	public class MigrationUserControl
	{
		[DataMember]
		public string AscxFilePath;

		[DataMember]
		public string AscxFileContent;

		[DataMember]
		public string AscxCodeBehindFileName;

		[DataMember]
		public string AscxFileCondeBehindContent;
	}

	[DataContract]
	public class MigrationMasterPage
	{
		public MigrationMasterPage()
		{
			UserControls = new List<MigrationUserControl>();
		}

		[DataMember]
		public string MasterPageName;

		[DataMember]
		public string MasterPagePath;

		[DataMember]
		public string MasterPageContents;

		[DataMember]
		public bool IsPrimary;

		[DataMember]
		public List<MigrationUserControl> UserControls;
	}

	[DataContract]
	[KnownType(typeof(MigrationCmsAscxControl))]
	[KnownType(typeof(MigrationCmsGenericContent))]
	[KnownType(typeof(MigrationCmsImage))]
	[KnownType(typeof(MigrationCmsDynamicHyperLink))]
	[KnownType(typeof(MigrationCmsListDisplay))]
	[KnownType(typeof(MigrationCmsSubscriptionForm))]
	[KnownType(typeof(MigrationCmsSearchBox))]
	[KnownType(typeof(MigrationCmsDownloadList))]
	[KnownType(typeof(MigrationCmsImageGallery))]
	[KnownType(typeof(MigrationCmsContentView))]
	[KnownType(typeof(MigrationCmsBlogPosts))]
	[KnownType(typeof(MigrationCmsEventsView))]
	[KnownType(typeof(MigrationCmsNewsView))]
	[KnownType(typeof(MigrationUserControl))]
	[KnownType(typeof(MigrationMasterPage))]
	public class MigrationTemplate
	{
		public MigrationTemplate()
		{
			Controls = new List<MigrationCmsWebControl>();
			MasterPages = new List<MigrationMasterPage>();
		}

		[DataMember]
		public string CmsProviderName;

		[DataMember]
		public bool ContainsUrlSrvc;

		[DataMember]
		public DateTime DateCreated;

		[DataMember]
		public DateTime DateModified;

		[DataMember]
		public Guid Id;

		[DataMember]
		public int LangId;

		[DataMember]
		public string LastModifier;

		[DataMember]
		public string Name;

		[DataMember]
		public string Status;

		[DataMember]
		public string Theme;

		[DataMember]
		public int Version;

		[DataMember]
		public List<MigrationCmsWebControl> Controls;

		[DataMember]
		public List<MigrationMasterPage> MasterPages;
	}

	[DataContract]
	[KnownType(typeof(MigrationCmsAscxControl))]
	[KnownType(typeof(MigrationCmsGenericContent))]
	[KnownType(typeof(MigrationCmsImage))]
	[KnownType(typeof(MigrationCmsDynamicHyperLink))]
	[KnownType(typeof(MigrationCmsListDisplay))]
	[KnownType(typeof(MigrationCmsSubscriptionForm))]
	[KnownType(typeof(MigrationCmsSearchBox))]
	[KnownType(typeof(MigrationCmsDownloadList))]
	[KnownType(typeof(MigrationCmsImageGallery))]
	[KnownType(typeof(MigrationCmsContentView))]
	[KnownType(typeof(MigrationCmsBlogPosts))]
	[KnownType(typeof(MigrationCmsEventsView))]
	[KnownType(typeof(MigrationCmsNewsView))]
	public class MigrationPage
	{
		public MigrationPage()
		{
			Controls = new List<MigrationCmsWebControl>();
			Permissions = new List<MigrationPermission>();
			Urls = new List<string>();
		}

		[DataMember]
		public int LangID;

		[DataMember]
		public string CmsProviderName;

		[DataMember]
		public bool ContainsUrlSrvc;

		[DataMember]
		public string DefaultUrl;

		[DataMember]
		public DateTime DateCreated;

		[DataMember]
		public DateTime DateModified;

		[DataMember]
		public bool DenyAnonymous;

		[DataMember]
		public bool DenyIndexing;

		[DataMember]
		public string Description;

		[DataMember]
		public bool DisableViewState;

		[DataMember]
		public string ExternalUrl;

		[DataMember]
		public Guid Id;

		[DataMember]
		public bool IsHomePage;

		[DataMember]
		public string Keywords;

		[DataMember]
		public string MasterPage;

		[DataMember]
		public string MenuName;

		[DataMember]
		public string Name;

		[DataMember]
		public bool Navigable;

		[DataMember]
		public int Ordinal;

		[DataMember]
		public string Owner;

		[DataMember]
		public string PageType;

		[DataMember]
		public Guid ParentId;

		[DataMember]
		public bool RequireCaching;

		[DataMember]
		public bool RequireSsl;

		[DataMember]
		public string Status;

		[DataMember]
		public Guid TemplateId;

		[DataMember]
		public string TemplateName;

		[DataMember]
		public string Theme;

		[DataMember]
		public string Title;

		[DataMember]
		public int Version;

		[DataMember]
		public List<MigrationCmsWebControl> Controls;

		[DataMember]
		public List<MigrationPermission> Permissions;

		[DataMember]
		public List<string> Urls;
	}

	[DataContract]
	public class MigrationPageGroup
	{
		public MigrationPageGroup()
		{
			Pages = new List<MigrationPage>();
		}

		[DataMember]
		public List<MigrationPage> Pages;
	}

	[DataContract]
	public class MigrationRole
	{
		[DataMember]
		public string Name;
	}

	[DataContract]
	public class MigrationUser
	{
		public MigrationUser()
		{
			Roles = new List<string>();
		}

		[DataMember]
		public string ApplicationName;

		[DataMember]
		public string Comment;

		[DataMember]
		public DateTime CreationDate;

		[DataMember]
		public string Email;

		[DataMember]
		public bool IsApproved;

		[DataMember]
		public bool IsLockedOut;

		[DataMember]
		public DateTime LastActivityDate;

		[DataMember]
		public DateTime LastLockoutDate;

		[DataMember]
		public DateTime LastLoginDate;

		[DataMember]
		public DateTime LastPasswordChangedDate;

		[DataMember]
		public string Password;

		[DataMember]
		public string PasswordQuestion;

		[DataMember]
		public string ProviderName;

		[DataMember]
		public string ProviderUserKey;

		[DataMember]
		public string Username;

		[DataMember]
		public string FirstName;

		[DataMember]
		public string LastName;

		[DataMember]
		public string Position;

		[DataMember]
		public List<string> Roles;
	}
}